import os
import glob
import pandas
from conf.config import ClassFicationCode
def DataHandler():
    csvList=glob.glob('./cache/{0}/*.csv'.format(ClassFicationCode))
    try:
        os.mkdir('./DATA/')
    except Exception as e:
        pass
    for i in csvList:
        fr=open(i,'r').read()
        with open('./DATA/{0}result.csv'.format(ClassFicationCode),'a') as f:
            f.write(fr)
    dfCSV=pandas.read_csv('./DATA/{0}result.csv'.format(ClassFicationCode),header=None,encoding='utf-8',low_memory=False)
    dfCSV=dfCSV.drop_duplicates()
    dfCSV=dfCSV[dfCSV[13].notnull()]
    dfCSV=dfCSV[dfCSV[0].notnull()]
    dfCSV=dfCSV[~(dfCSV[0].isin(['U']))]
    dfCSV.to_csv('./DATA/{0}result.csv'.format(ClassFicationCode),index=False,header=False)